Skip to content

feat: better reject null characters in forms#7472

Merged
rjsparks merged 3 commits intoietf-tools:mainfrom
jennifer-richards:model-multiple-choice-field
May 28, 2024
Merged

feat: better reject null characters in forms#7472
rjsparks merged 3 commits intoietf-tools:mainfrom
jennifer-richards:model-multiple-choice-field

Conversation

@jennifer-richards
Copy link
Copy Markdown
Member

Replaces Django's forms.ModelMultipleChoiceField with a subclass that applies the ProhibitNullCharactersValidator to the submitted values before calling the superclass clean() method. This works around an apparent bug in Django that causes it to throw a server error instead of properly marking the form as invalid.

We've mostly seen this abused in the SearchForm, but I've preemptively replaced all our use of the field class.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.91%. Comparing base (187c2c5) to head (201075a).
Report is 216 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7472      +/-   ##
==========================================
- Coverage   88.98%   88.91%   -0.08%     
==========================================
  Files         291      294       +3     
  Lines       40717    41196     +479     
==========================================
+ Hits        36233    36630     +397     
- Misses       4484     4566      +82     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rjsparks rjsparks merged commit 08e9539 into ietf-tools:main May 28, 2024
@jennifer-richards jennifer-richards deleted the model-multiple-choice-field branch May 28, 2024 17:55
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants